package kr.hkit.androidcomplete01.ch11;

import kr.hkit.androidcomplete01_.R;
import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.TextView;

public class TextChange extends Activity {
	private EditText mEdit;
	private TextView mText;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch11_textchange);
		
		mEdit = (EditText) findViewById(R.id.edit);
		mText = (TextView) findViewById(R.id.text);
		
		mEdit.addTextChangedListener(mWatcher);
	}
	
	TextWatcher mWatcher = new TextWatcher() {
		
		@Override
		public void onTextChanged(CharSequence s, int start, int before, int count) {
			mText.setText("echo:" + s + "start:" + start + "before:" + before + "count:" + count);

		}
		
		@Override
		public void beforeTextChanged(CharSequence s, int start, int count,
				int after) {
			// TODO Auto-generated method stub
			
		}
		
		@Override
		public void afterTextChanged(Editable s) {
			// TODO Auto-generated method stub
			
		}
	};
}
